<template>
  <el-form :ref="'form' + item.itemName">
    <el-form-item :label="item.itemName == 1?'':item.itemName" :label-width="labelWith">
      <el-checkbox-group  v-model="item.indicatorsActVal" :disabled="isFinish">
        <el-checkbox v-for="item in options"
                     :key="item.key"
                     :label="item.key"
                     :value="item.key">{{item.key}}</el-checkbox>
      </el-checkbox-group>
    </el-form-item>
  </el-form>
</template>

<script>
import { searchDict } from "@/api/dict";

export default {
  name: "MyCheckBox",
  props: {
    isFinish:{
      type:Boolean,
      default:false
    },
    item: Object,
    labelWith: {
      type: String,
      default: ""
    },
  },
  created() {
    this.item.indicatorsActVal = []
    searchDict({ id: this.item.dictId }).then(response => {
      if (response.code === 200) {
        this.options = response.page.filter(function(item) {
          return item.available;
        });
      }
    });
    if (this.item.remark) {
      this.style = "min-width" + this.item.remark + "px !important"
    }
  },
  data() {
    return {
      options: []
    };
  },
  methods: {}
};
</script>
